# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libssh2

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.4.3
pkgrel=2
pkgdesc="A library implementing the SSH2 protocol as defined by Internet Drafts (mingw-w64)"
arch=('any')
url="http://www.libssh2.org"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-zlib")
depends=("${MINGW_PACKAGE_PREFIX}-openssl" "${MINGW_PACKAGE_PREFIX}-zlib")
groups=("${MINGW_PACKAGE_PREFIX}")
options=('staticlibs' 'strip')
source=("$url/download/${_realname}-$pkgver.tar.gz")
md5sums=('071004c60c5d6f90354ad1b701013a0b')

build() {
  mkdir -p "${srcdir}/${_realname}-${pkgver}-build-${CARCH}"
  cd "${srcdir}/${_realname}-${pkgver}-build-${CARCH}"
  "${srcdir}"/${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --with-openssl
  make
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}-build-${CARCH}"
  make DESTDIR="$pkgdir" install
}
